//----------------------------------------------------------------------------
//  ,-.
// /_\___ ,   Ninja Framework
// '  ___\    (C) Riccardo Capra - http://riccar.do
//  //   \\
//----------------------------------------------------------------------------
//  This program is free software: you can redistribute it and/or modify
//  it under the terms of the GNU General Public License as published by
//  the Free Software Foundation, either version 3 of the License, or
//  (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
//
//  You should have received a copy of the GNU General Public License
//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
//----------------------------------------------------------------------------

#ifndef NJ_SEMAPHORE_CONFIG_H
#	define NJ_SEMAPHORE_CONFIG_H

#	include "NjNinjaSyncLib.h"

/// \def NJ_SEMAPHORE_TRACKING_ENABLED
/// \brief Semaphores call order is stored into a fast circular buffer
///
/// This can help debugging concurrency issues

/// \def NJ_SEMAPHORE_STORE_USERS_ENABLED
/// \brief Stores how may threads are concurrently accessing to the same semaphore methods
///
/// This is used to detect semaphore destruction, while other threads are still accessing to it

/// \def NJ_SEMAPHORE_ENFORCE_MAX_COUNTER
/// \brief Enforces the constraint set during construction with the \em uMaxCounter parameter
///
/// If the semaphore counter exceeds this limit an assertion will be triggered

#	if defined(NJ_CONFIGURATION_DEBUG)
#		define NJ_SEMAPHORE_TRACKING_ENABLED 1
#		define NJ_SEMAPHORE_STORE_USERS_ENABLED 1
#		define NJ_SEMAPHORE_ENFORCE_MAX_COUNTER 1
#	elif defined(NJ_CONFIGURATION_RELEASE)
#		define NJ_SEMAPHORE_TRACKING_ENABLED 0
#		define NJ_SEMAPHORE_STORE_USERS_ENABLED 1
#		define NJ_SEMAPHORE_ENFORCE_MAX_COUNTER 1
#	elif defined(NJ_CONFIGURATION_SHIPPING)
#		define NJ_SEMAPHORE_TRACKING_ENABLED 0
#		define NJ_SEMAPHORE_STORE_USERS_ENABLED 0
#		define NJ_SEMAPHORE_ENFORCE_MAX_COUNTER 0
#	endif

#	ifndef NJ_SEMAPHORE_TRACKING_ENABLED
#		error "Unsupported build configuration"
#	endif // NJ_SEMAPHORE_TRACKING_ENABLED

#	ifndef NJ_SEMAPHORE_STORE_USERS_ENABLED
#		error "Unsupported build configuration"
#	endif // NJ_SEMAPHORE_STORE_USERS_ENABLED

#	ifndef NJ_SEMAPHORE_ENFORCE_MAX_COUNTER
#		error "Unsupported build configuration"
#	endif // NJ_SEMAPHORE_ENFORCE_MAX_COUNTER

#endif // NJ_SEMAPHORE_CONFIG_H
